//
//  MenuCollectionCell.m
//  BaseProject
//
//  Created by 王洋 on 2020/7/24.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "MenuCollectionCell.h"

@implementation MenuCollectionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    self.itemPriceLab.userInteractionEnabled = YES;
      [self.itemPriceLab addGestureTapEventHandle:^(id  _Nonnull sender, UITapGestureRecognizer * _Nonnull gestureRecognizer) {
          if (self.MenuCollectionLoginBlock) {
              self.MenuCollectionLoginBlock();
          }
      }];
}

- (void)fillCellWithModel:(CommonMenuModel *)model {
    
    self.itemMainTitleLab.text = model.bhmMenuName;
    [self.itemMainImageView sd_setImageWithURL:[NSURL URLWithString:model.bhmTransverseImg] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    
//    if ([TTUserModel sharedObject].token.length > 0) {
        self.itemPriceLab.text = [NSString stringWithFormat:@"¥%@/桌",[Utilities changeDoubleToString:model.bhmMenuPrice]];
        
//    } else {
//        self.itemPriceLab.text = @"登录后查看补贴价";
//    }
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        [self.itemMainImageView pp_clipCorners:UIRectCornerAllCorners radius:8];
        
    });
    
}

@end
